package com.tianshuo.aop.main;

import com.tianshuo.aop.aspectj.LogAspectJ;
import com.tianshuo.aop.service.Service;
import com.tianshuo.aop.config.AopConfig;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @ClassName : AnnotationApplicationContextTest
 * @Description : 注解配置spring启动类
 * @Author : tianshuo
 * @Date: 2020-08-20 11:24
 */
public class AspectjAnnotationConfigApplicationContextTest {

	public static void main(String[] args) {

		AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(AopConfig.class);
		System.out.println(applicationContext.getBean(LogAspectJ.class));
		Object service = applicationContext.getBean("orderService");
		System.out.println("对象类型: "+service.getClass());
		Service orderService = (Service) service;
		System.out.println(orderService.service("springEnhance"));
	}
}

